//电影管理

var express = require('express');
var router = express.Router();
var sqlQuery = require('../../../module/sql');

/* GET users listing. */
router.get('/', async(req, res, next)=> {
  let tid = req.query.id
  let sqlStr = 'select * from type where id = ?';
  let result = await sqlQuery(sqlStr,[tid])
  let type =  result[0]
  let options = {type}
  res.render('admin/category/categoryedit',options)
  
});


router.post('/', async(req, res)=>{
  let typeName = req.body.typeName
  let typeid = req.body.typeid
  let sqlStr1 = "update type set typeName=? where id = ?"
  let arr = [typeName,typeid]
  await sqlQuery(sqlStr1,arr)
  res.json({
    state:"ok",
    content:"标签信息更新成功"
  })

})

module.exports = router;
